//
//  LGReportHolderCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/9/1.
//

#import "LGReportHolderCell.h"

@interface LGReportHolderCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIView *formView;
/**   */
@property (nonatomic , strong)UIView *segmentView;
/**   */
@property (nonatomic , strong)UIView *topLine;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGReportHolderCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    self.titleLabel.text = LGNSString(dataDic[@"name"]);
    self.contentLabel.text = LGNSString(dataDic[@"number"]);
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self.contentView addSubview:self.baseView];
    [self.baseView addSubview:self.formView];
    [self.baseView addSubview:self.segmentView];
    [self.baseView addSubview:self.topLine];
    [self.baseView addSubview:self.titleLabel];
    [self.baseView addSubview:self.contentLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(-viewPix(5));
        make.left.equalTo(self.contentView).offset(viewPix(16));
        make.right.equalTo(self.contentView).offset(-viewPix(16));
        make.bottom.equalTo(self.contentView).offset(viewPix(5));
        make.height.equalTo(@(viewPix(42)));
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.1 radius:0];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIView *)formView{
    if(!_formView){
        _formView = [[UIView alloc] initWithFrame:CGRectMake(viewPix(12), 0, Screen_W-viewPix(56), viewPix(42))];
        _formView.layer.borderColor = [UIColor colorWithString:@"#E0E0E0"].CGColor;
        _formView.layer.borderWidth = 1.0;
    }
    return _formView;
}

-(UIView *)segmentView{
    if(!_segmentView){
        _segmentView = [[UIView alloc] initWithFrame:CGRectMake(kMaxX(self.titleLabel.frame), 0, 0.5, viewPix(42))];
        _segmentView.backgroundColor = [UIColor colorWithString:@"#E0E0E0"];
    }
    return _segmentView;
}

-(UIView *)topLine{
    if(!_topLine){
        _topLine = [[UIView alloc] initWithFrame:CGRectMake(viewPix(12), viewPix(5), Screen_W-viewPix(56), 0.5)];
        _topLine.backgroundColor = [UIColor colorWithString:@"#E0E0E0"];
    }
    return _topLine;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"支架部位" colorString:@"#333333" textFont:LGFont(13) textAlignment:NSTextAlignmentCenter lines:1];
        _titleLabel.frame = CGRectMake(0, 0, (Screen_W-viewPix(56))/2.0, viewPix(42));
    }
    return _titleLabel;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"支架数量" colorString:@"#333333" textFont:LGFontWeight(13, UIFontWeightMedium) textAlignment:NSTextAlignmentCenter lines:1];
        _contentLabel.frame = CGRectMake(kMaxX(self.titleLabel.frame), 0, (Screen_W-viewPix(56))/2.0, viewPix(42));
    }
    return _contentLabel;
}


@end
